
package com.insigma.business.qrcode.common.converter;



import com.insigma.business.qrcode.soldier.dto.PlacementPositionInfoBSearcher;
import com.insigma.business.qrcode.soldier.dto.PlacementPositionInfoDTO;
import com.insigma.business.qrcode.soldier.entity.PlacementPositionInfoDO;
import com.insigma.business.qrcode.soldier.request.PlacementPositionInfoInsertRequest;
import com.insigma.business.qrcode.soldier.request.PlacementPositionInfoSearchRequest;
import com.insigma.business.qrcode.soldier.request.PlacementPositionInfoUpdateRequest;
import org.springframework.beans.BeanUtils;

import java.util.List;


public class PlacementPositionInfoProviderConverter extends AbstractConverter<PlacementPositionInfoDTO, PlacementPositionInfoDO> {

    private final static PlacementPositionInfoProviderConverter placementPositionInfoConverter = new PlacementPositionInfoProviderConverter();

    private PlacementPositionInfoProviderConverter(){}

    
    public static PlacementPositionInfoBSearcher convertRequestSO2Searcher(final PlacementPositionInfoSearchRequest request){
        final PlacementPositionInfoBSearcher placementPositionInfoBSearcher = new PlacementPositionInfoBSearcher(request.getPageNo(),
        request.getPageSize(),request.getSortKeyValueJoint());
        BeanUtils.copyProperties(request,placementPositionInfoBSearcher);
        return placementPositionInfoBSearcher;
    }

    
    public static PlacementPositionInfoDO convertRequestUO2DO(final PlacementPositionInfoUpdateRequest placementPositionInfoUpdateRequest) {
        final PlacementPositionInfoDO placementPositionInfoDO = new PlacementPositionInfoDO();
        BeanUtils.copyProperties(placementPositionInfoUpdateRequest,placementPositionInfoDO);
        
        return placementPositionInfoDO;
    }

    
    public static PlacementPositionInfoDO convertRequestIO2DO(final PlacementPositionInfoInsertRequest placementPositionInfoInsertRequest) {
        final PlacementPositionInfoDO placementPositionInfoDO = new PlacementPositionInfoDO();
        BeanUtils.copyProperties(placementPositionInfoInsertRequest,placementPositionInfoDO);
        return placementPositionInfoDO;
    }

    
    public static List<PlacementPositionInfoDTO> convertResponseDOList2DTOList(final List<PlacementPositionInfoDO> placementPositionInfoDOList){
        return placementPositionInfoConverter.convertGenericResponseDOList2DTOList(placementPositionInfoDOList);
    }

    
    public static PlacementPositionInfoDTO convertResponseDO2DTO(final PlacementPositionInfoDO placementPositionInfoDO){
        return placementPositionInfoConverter.convertGenericResponseDO2DTO(placementPositionInfoDO);
    }

    
    @Override
    protected PlacementPositionInfoDTO doConvertResponseDO2DTO(PlacementPositionInfoDO placementPositionInfoDO) {
        final PlacementPositionInfoDTO placementPositionInfoDTO = new PlacementPositionInfoDTO();
        try {
            BeanUtils.copyProperties(placementPositionInfoDO, placementPositionInfoDTO);
        }catch(RuntimeException be){
            
            return null;
        }
        return placementPositionInfoDTO;
    }

}
